<?php
// application/resources/Navigation.php
/**
 * Resource_Navigation
 *
 * demo-zf application
 *
 * For now this resource is configurated inside this class
 * because of gettext translation specification
 *
 * To configure navigation $pagesConfig array must be modified
 *
 * @author Adam Pilacki <adam.pilacki@gmail.com>
 */
final class Resource_Navigation
    extends Lib_ResourceAbstract
{

    /**
     * Set navigation properties
     *
     * @return true
     */
    protected final function _getResource()
    {
        $translator = $this->getBootstrap()->getResource('Translate');

        $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();

        $pagesConfig = array(
            array(
                'label'      => $translator->translate('moduł default'),
                'uri'        =>  '',
                'pages'      =>
                    array(
                        array(
                            'label'      => $translator->translate('mój profil'),
                            'route'      => 'default-index-index',
//                            'type'       => 'uri',
//                            'uri'        => Zend_Controller_Front::getInstance()->getBaseUrl(),
                        ),
                        array(
                            'label'      => $translator->translate('pliki do pobrania'),
                            'module'     => 'default',
                            'controller' => 'index',
                            'action'     => 'download',
                            'route'      => 'default',
                        ),
                        array(
                            'label'      => $translator->translate('rejestracja nowego użytkownika'),
                            'module'     => 'default',
                            'controller' => 'user',
                            'action'     => 'register',
                            'route'      => 'default',
                        ),
                        array(
                            'label'      => $translator->translate('rejestracja nowego użytkownika'),
                            'module'     => 'default',
                            'controller' => 'user',
                            'action'     => 'create',
                            'route'      => 'default',
                        ),
                    )
            ),
            array(
                'label'      => $translator->translate('moduł blog'),
                'uri'        => '',
                'pages'      =>
                    array(
                        array(
                            'label'      => $translator->translate('blogi'),
                            'module'     => 'blog',
                            'controller' => 'index',
                            'action'     => 'index',
                            'route'      => 'default',
                        ),
                    )
            )
        );

        $navigation = new Zend_Navigation($pagesConfig);

        /* set up navigation container */
        $navigation->setPages($pagesConfig);
        Zend_Registry::set('Zend_Navigation', $navigation);

        return $navigation;
    }
}